package com.cws.project.cws.resitscore.service.impl;

import java.util.List;

import com.cws.common.utils.DateUtils;
import com.cws.common.utils.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cws.project.cws.resitscore.mapper.CourseResitScoreMapper;
import com.cws.project.cws.resitscore.domain.CourseResitScore;
import com.cws.project.cws.resitscore.service.ICourseResitScoreService;

/**
 * 补考得分Service业务层处理
 *
 * @author xyl
 * @date 2022-03-26
 */
@Service
public class CourseResitScoreServiceImpl implements ICourseResitScoreService {
    @Autowired
    private CourseResitScoreMapper courseResitScoreMapper;

    /**
     * 查询补考得分
     *
     * @param resitScoreId 补考得分ID
     * @return 补考得分
     */
    @Override
    public CourseResitScore selectCourseResitScoreById(Long resitScoreId) {
        return courseResitScoreMapper.selectCourseResitScoreById(resitScoreId);
    }

    /**
     * 查询补考得分列表
     *
     * @param courseResitScore 补考得分
     * @return 补考得分
     */
    @Override
    public List<CourseResitScore> selectCourseResitScoreList(CourseResitScore courseResitScore) {
        return courseResitScoreMapper.selectCourseResitScoreList(courseResitScore);
    }

    /**
     * 新增补考得分
     *
     * @param courseResitScore 补考得分
     * @return 结果
     */
    @Override
    public int insertCourseResitScore(CourseResitScore courseResitScore) {
        courseResitScore.setCreateTime(DateUtils.getNowDate());
        return courseResitScoreMapper.insertCourseResitScore(courseResitScore);
    }

    /**
     * 修改补考得分
     *
     * @param courseResitScore 补考得分
     * @return 结果
     */
    @Override
    public int updateCourseResitScore(CourseResitScore courseResitScore) {
        courseResitScore.setUpdateTime(DateUtils.getNowDate());
        return courseResitScoreMapper.updateCourseResitScore(courseResitScore);
    }

    /**
     * 删除补考得分对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCourseResitScoreByIds(String ids) {
        return courseResitScoreMapper.deleteCourseResitScoreByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除补考得分信息
     *
     * @param resitScoreId 补考得分ID
     * @return 结果
     */
    @Override
    public int deleteCourseResitScoreById(Long resitScoreId) {
        return courseResitScoreMapper.deleteCourseResitScoreById(resitScoreId);
    }

    @Override
    public CourseResitScore selectCourseResitScoreByRepet(Long resitId, Long userId) {
        return courseResitScoreMapper.selectCourseResitScoreByRepet(resitId,userId);
    }
}
